<?php
//Zend_Loader::loadFile('../application/admin/models/Template.php');
class Rates 
{
    /**
     * @var object Zend DB Adapter
     */
    private $_db;
    /**
     * @var string
     */
   
    public function __construct()
    {
			$this->_db = Zend_Registry::get('db');
    }
    
    public function listRates($hotel_id)
    {
    	$sql="select * from hotel_rates where hotel_id=".$hotel_id."	";
    	//	echo $sql;exit;
    	$getNewsletters = $this->_db->fetchAll($sql);
		
		return $getNewsletters;
	}
	
	public function getrate($rate_id)
    {
    	$sql="select * from hotel_rates where rate_id=".$rate_id."	";
    	//echo $sql;exit;
    	$getNewsletters = $this->_db->fetchrow($sql);
		
		return $getNewsletters;
	}
	
	

    public function getHotel($hotel_id)
    {
    	//echo $hotel_id;exit;
    $sql="
			select hotel_id,hotel_title,hotel_city,hotel_country,hotel_description,
    	 hotel_contactperson,hotel_phone,hotel_fax,hotel_skype,is_Enabled
			from  Rates where   hotel_id='".$hotel_id."'
			
		";
  // echo $sql;exit;
    	$getHotel = $this->_db->fetchrow($sql);
	//	print_r($getHotel);exit;
		return $getHotel;
       
    }

    public function addRate($hotel_id,$rate_category,$rate_basis,$rate_single,$rate_double,	$rate_triple,$rate_fromdate,$rate_todate,$rate_additionalinfo)
    {
    	 $sql="insert into hotel_rates 
    	 (hotel_id,rate_category,rate_basis,rate_single,rate_double,rate_triple,rate_fromdate,rate_todate,rate_additionalinfo) values
    	 ('".$hotel_id."','".$rate_category."','".$rate_basis."','".$rate_single."','".$rate_double."','".$rate_triple."','".$rate_fromdate."','".$rate_todate."','".$rate_additionalinfo."')";
    	//echo $sql;exit;
    	 $addhotel=$this->_db->exec($sql);
        return  $addhotel;
    } 
    
        public function editRate($rate_id,$rate_category,$rate_basis,$rate_single,$rate_double,$rate_triple,$rate_fromdate,$rate_todate,$rate_additionalinfo)
    {
    	 $sql="update hotel_rates set rate_category='".$rate_category."',rate_basis='".$rate_basis."' ,
    	 rate_single='".$rate_single."',rate_double='".$rate_double."',rate_triple='".$rate_triple."',rate_fromdate='".$rate_fromdate."',
    	 rate_todate='".$rate_todate."',rate_additionalinfo='".$rate_additionalinfo."' where rate_id=".$rate_id."
    	 
    	 
    	 
    	 ";
    	 
          // echo $sql;exit;
    	 $edit=$this->_db->exec($sql);
        return  $edit;
    } 

   

    public function deleteRate($Rate_id)
    {
    	$command="delete from hotel_rates where rate_id=".$Rate_id."";
    	
    	//echo $command;exit;
       $DeleteRates = $this->_db->exec($command);
      
		return $DeleteRates;
        
    }


    

}

